package com.zzu.utils;

import android.content.Context;

import com.zzu.MyApplication;
import com.zzu.R;

import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

/**
 * @description:
 * @author: zb
 * @date: 2021-05-06 20:48
 * 单例类，获取Service接口动态代理对象
 */
public class ServiceCreator {

    //在资源文件中获取服务器的基础url
//    private static final String BASE_URL =  MyApplication.getContext().getResources().getString(R.string.url);
//    private static final String BASE_URL = "http://10.95.176.40:8080/";
//    private static final String BASE_URL = "http://192.168.1.106:8080/";
    private static final String BASE_URL = "http://120.53.17.250:8081/";

    private static Retrofit mRetrofit = new Retrofit.Builder().baseUrl(BASE_URL).addConverterFactory(GsonConverterFactory.create()).build();

    public static  <T> T getRetrofit(Class<T> classT) {
        return mRetrofit.create(classT);
    }
}
